<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8">
        <title>新增页面</title>
        <link rel="stylesheet" href="/app/admin/component/pear/css/pear.css" />
        <link rel="stylesheet" href="/app/admin/component/jsoneditor/css/jsoneditor.css" />
        <link rel="stylesheet" href="/app/admin/admin/css/reset.css" />
    </head>
    <body>

        <form class="layui-form" action="">

            <div class="mainBox">
                <div class="main-container mr-5">
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">mall_id</label>
                        <div class="layui-input-block">
                            <input type="number" name="mall_id" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">mch_id</label>
                        <div class="layui-input-block">
                            <input type="number" name="mch_id" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">订单流水号</label>
                        <div class="layui-input-block">
                            <input type="text" name="order_no" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">一卡通商品ID</label>
                        <div class="layui-input-block">
                            <input type="number" name="onecard_id" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">一卡通商品名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="onecard_name" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">年卡发行批次</label>
                        <div class="layui-input-block">
                            <input type="text" name="batch_id" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">状态:0=待支付,1=已支付,2=已退款,3=已过期,4=退款审核中,5-用户已取消</label>
                        <div class="layui-input-block">
                            <input type="number" name="status" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">购买用户id</label>
                        <div class="layui-input-block">
                            <input type="number" name="user_id" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">下单用户IP</label>
                        <div class="layui-input-block">
                            <input type="text" name="user_ip" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">出行人id</label>
                        <div class="layui-input-block">
                            <input type="number" name="contact_id" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label required">购买的商品数量</label>
                        <div class="layui-input-block">
                            <input type="number" name="product_count" value="" required lay-verify="required" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">电子券短信密码</label>
                        <div class="layui-input-block">
                            <input type="text" name="sms_pwd" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">取消类型</label>
                        <div class="layui-input-block">
                            <input type="number" name="cancel_type" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">支付订单编号</label>
                        <div class="layui-input-block">
                            <input type="number" name="pay_order_id" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否已支付：[0:未支付 1:已经支付过]</label>
                        <div class="layui-input-block">
                            <input type="text" name="pay_status" value="b'0'" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">下单日期</label>
                        <div class="layui-input-block">
                            <input type="text" name="order_date" id="order_date" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">支付平台支付订单号</label>
                        <div class="layui-input-block">
                            <input type="text" name="out_trade_no" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">订单支付时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="pay_time" id="pay_time" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">支付成功的支付渠道</label>
                        <div class="layui-input-block">
                            <input type="text" name="pay_channel_code" value="1" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">过期时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="expired_time" id="expired_time" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">订单取消时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="cancel_time" id="cancel_time" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">退款时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="refund_time" id="refund_time" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">商品原价（总），单位：分</label>
                        <div class="layui-input-block">
                            <input type="number" name="total_price" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">订单优惠（总），单位：分</label>
                        <div class="layui-input-block">
                            <input type="number" name="discount_price" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">应付金额（总），单位：分</label>
                        <div class="layui-input-block">
                            <input type="number" name="pay_price" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">使用的优惠劵编号</label>
                        <div class="layui-input-block">
                            <input type="number" name="coupon_id" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">优惠劵减免金额，单位：分</label>
                        <div class="layui-input-block">
                            <input type="number" name="coupon_price" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">退款状态</label>
                        <div class="layui-input-block">
                            <input type="number" name="refund_status" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">退款说明</label>
                        <div class="layui-input-block">
                            <input type="text" name="refund_remark" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">退款金额，单位：分</label>
                        <div class="layui-input-block">
                            <input type="number" name="refund_price" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">创建者</label>
                        <div class="layui-input-block">
                            <input type="text" name="creator" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">创建时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="create_time" id="create_time" value="CURRENT_TIMESTAMP" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">更新者</label>
                        <div class="layui-input-block">
                            <input type="text" name="updater" value="" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">更新时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="update_time" id="update_time" value="CURRENT_TIMESTAMP" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否删除</label>
                        <div class="layui-input-block">
                            <input type="text" name="deleted" value="b'0'" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">租户编号</label>
                        <div class="layui-input-block">
                            <input type="number" name="tenant_id" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户订单核销状态：0-待核销；1-已核销；2-已确认；3-已退款</label>
                        <div class="layui-input-block">
                            <input type="number" name="mer_order_state" value="0" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户订单确认收货时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="mer_confirm_date" id="mer_confirm_date" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户订单确认信息</label>
                        <div class="layui-input-block">
                            <input type="text" name="mer_order_msg" value="" class="layui-input">
                        </div>
                    </div>
                    
                </div>
            </div>

            <div class="bottom">
                <div class="button-container">
                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-md" lay-submit=""
                        lay-filter="save">
                        提交
                    </button>
                    <button type="reset" class="pear-btn pear-btn-md">
                        重置
                    </button>
                </div>
            </div>
            
        </form>

        <script src="/app/admin/component/layui/layui.js?v=2.8.12"></script>
        <script src="/app/admin/component/pear/pear.js"></script>
        <script src="/app/admin/component/jsoneditor/jsoneditor.js"></script>
        <script src="/app/admin/admin/js/permission.js"></script>
        
        <script>

            // 相关接口
            const INSERT_API = "/app/admin/tejian-onecard-order/insert";
            
            // 字段 下单日期 order_date
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#order_date",
                    type: "datetime",
                });
            })
            
            // 字段 订单支付时间 pay_time
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#pay_time",
                    type: "datetime",
                });
            })
            
            // 字段 过期时间 expired_time
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#expired_time",
                    type: "datetime",
                });
            })
            
            // 字段 订单取消时间 cancel_time
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#cancel_time",
                    type: "datetime",
                });
            })
            
            // 字段 退款时间 refund_time
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#refund_time",
                    type: "datetime",
                });
            })
            
            // 字段 创建时间 create_time
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#create_time",
                    type: "datetime",
                });
            })
            
            // 字段 更新时间 update_time
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#update_time",
                    type: "datetime",
                });
            })
            
            // 字段 商户订单确认收货时间 mer_confirm_date
            layui.use(["laydate"], function() {
                layui.laydate.render({
                    elem: "#mer_confirm_date",
                    type: "datetime",
                });
            })
            
            //提交事件
            layui.use(["form", "popup"], function () {
                // 字段验证允许为空
                layui.form.verify({
                    phone: [/(^$)|^1\d{10}$/, "请输入正确的手机号"],
                    email: [/(^$)|^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/, "邮箱格式不正确"],
                    url: [/(^$)|(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/, "链接格式不正确"],
                    number: [/(^$)|^\d+$/,'只能填写数字'],
                    date: [/(^$)|^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/, "日期格式不正确"],
                    identity: [/(^$)|(^\d{15}$)|(^\d{17}(x|X|\d)$)/, "请输入正确的身份证号"]
                });
                layui.form.on("submit(save)", function (data) {
                    layui.$.ajax({
                        url: INSERT_API,
                        type: "POST",
                        dateType: "json",
                        data: data.field,
                        success: function (res) {
                            if (res.code) {
                                return layui.popup.failure(res.msg);
                            }
                            return layui.popup.success("操作成功", function () {
                                parent.refreshTable();
                                parent.layer.close(parent.layer.getFrameIndex(window.name));
                            });
                        }
                    });
                    return false;
                });
            });

        </script>

    </body>
</html>
